package com.robot.merchant.client;

import com.robot.merchant.client.impl.OrdersClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author lin
 */
@Component
@FeignClient(value = "robot-orders", fallback = OrdersClientImpl.class)
public interface OrdersClient {
    /**
     * 根据storeId查找SubOrders
     *
     * @param storeId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByStoreId/{storeId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByStoreId(@PathVariable String storeId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据storeId查找今天订单
     *
     * @param storeId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByStoreIdAndToday/{storeId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByStoreIdAndToday(@PathVariable String storeId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据storeId查找昨天订单
     *
     * @param storeId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByStoreIdAndYesterday/{storeId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByStoreIdAndYesterday(@PathVariable String storeId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据storeId查找最近7日订单
     *
     * @param storeId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByStoreIdAndWeek/{storeId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByStoreIdAndWeek(@PathVariable String storeId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据storeId查找总订单
     *
     * @param storeId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByStoreIdAndTotal/{storeId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByStoreIdAndTotal(@PathVariable String storeId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据storeId查找昨天订单数和收益
     *
     * @param storeId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersCountByStoreIdAndYesterday/{storeId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersCountByStoreIdAndYesterday(@PathVariable String storeId, @PathVariable int page, @PathVariable int size);


    /**
     * 根据storeId查找最近7日订单数和收益
     *
     * @param storeId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersCountByStoreIdAndWeek/{storeId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersCountByStoreIdAndWeek(@PathVariable String storeId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据storeId查找总订单数和收益
     *
     * @param storeId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersCountByStoreIdAndTotal/{storeId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersCountByStoreIdAndTotal(@PathVariable String storeId, @PathVariable int page, @PathVariable int size);


    /**
     * 通过storeId查询purchase列表并分页
     *
     * @param storeId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "purchase/third/findPurchasesByStoreIdAndDeletedAtIsNullOrderByCreatedAtDesc/{storeId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindPurchasesByStoreIdAndDeletedAtIsNullOrderByCreatedAtDesc(@PathVariable String storeId, @PathVariable int page, @PathVariable int size);

    /**
     * 通过storeId和status查询purchase列表并分页
     *
     * @param storeId
     * @param status
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "purchase/third/findPurchasesByStoreIdAndStatusAndDeletedAtIsNullOrderByCreatedAtDesc/{storeId}/{status}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindPurchasesByStoreIdAndStatusAndDeletedAtIsNullOrderByCreatedAtDesc(@PathVariable String storeId, @PathVariable String status, @PathVariable int page, @PathVariable int size);

    /**
     * 通过storeId和id查询purchase列表并分页
     *
     * @param id
     * @param storeId
     * @return
     */
    @RequestMapping(value = "purchase/third/findPurchaseByIdAndStoreId/{id}/{storeId}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindPurchaseByIdAndStoreId(@PathVariable String id, @PathVariable String storeId);

}
